<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>
        <ui:composition template="./../Template/generalTemplate.xhtml">
            <ui:define name="content">
                <p:panel id="companyMgt" header="Sales Forcast for Product A" style="height:495px;">
                    <div style="margin-top:30px;margin-left:10px;">
                        <h:form id="form">
                            <p:growl id="msgs" showDetail="true" /> 
                               <h:outputText value="#{salesForecastManagedBean.yoyGrowth}" style="font-weight:bold" rendered="#{!deleteCompanyManagedBean.editMode}"/>  
                               <p:inputText id="address"   requiredMessage="Address cannot be empty" value="#{deleteCompanyManagedBean.selectedCompany.address}" rendered="#{deleteCompanyManagedBean.editMode}" required="true" label="Company Address"/>  
                                      
                            <p:dataTable id="forecast" value="#{salesForecastManagedBean.getMonthlyForecasts()}" var="monthlyForecast" paginator="true" >

                                <p:column headerText="Month">
                                    <h:outputText value="#{monthlyForecast.eachMonth}"/>
                                </p:column>

                                <p:column headerText="Previous Year">
                                    <h:outputText value="#{monthlyForecast.previousA}"/>
                                </p:column>
                                <p:column headerText="Promotion Sales">
                                    <h:outputText value="#{monthlyForecast.prePromotionA}"/>
                                </p:column>
                                <p:column headerText="Previous Year Base">
                                    <h:outputText value="#{monthlyForecast.preSubProA}"/>
                                </p:column>
                                <p:column headerText="YoY Growth">
                                    <h:outputText value="#{monthlyForecast.yoyGrowthA}"/>
                                </p:column>
                                <p:column headerText="Base Projection">
                                    <h:outputText value="#{monthlyForecast.baseProjectionA}"/>
                                </p:column>
                                <p:column headerText="Promotion">
                                    <h:outputText value="#{monthlyForecast.newPromotionA}"/>
                                </p:column>
                                <p:column headerText="Sales Forecast">
                                    <h:outputText value="#{monthlyForecast.salesForcastA}"/>
                                </p:column>
                             
                           </p:dataTable>  
                                 <p:commandButton value="Submit"  ajax="false"  update="grid" actionListener="#{salesForecastManagedBean.getForecastData}">
                       
                    </p:commandButton>
                        </h:form>  
                    </div>
                </p:panel>
            </ui:define>
        </ui:composition>
    </body>
</html>